<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>cross domain</title>
</head>
<body>
    <h3>mac地址：</h3>
    <span>{{ mac }}</span>
    <p></p>
    <a href="http://60.174.116.164:8349">去登录</a>
    <div>
        <iframe src="http://60.174.116.164:8349/getmessage.html" frameborder="0"></iframe>
    </div>
    <script>
        window.onload = function(){
            //在页面加载完成后主页面向iframe发送请求
            window.frames[0].postMessage("{{ jsonMac }}",'http://60.174.116.164:8349');
        }
        // 主页面监听message事件,
        window.addEventListener('message', function(e){
            var data = e.data;
            document.querySelector('p').innerHTML = data;
        }, false);
    </script>
</body>
</html>